package cn.xi.dao;

import cn.xi.pojo.Permission;
import cn.xi.pojo.Role;
import cn.xi.pojo.User;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;


import java.util.List;
import java.util.Set;

public interface SecuritySpringDao {

    @Select("select * from t_user where username = #{name}")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "username", column = "username"),
            @Result(property = "password", column = "password"),
            @Result(property = "roles", column = "id", javaType = Set.class, many = @Many(select = "cn.xi.dao.RoleDao.findRoles"))
    })
    User findSecurity(String name);


}
